<?php

namespace App\Modules\Admin\Http\Controllers\System;

use App\Modules\Admin\Services\BaseService;
use App\Modules\Admin\Services\System\AgreementService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class AgreementController extends BaseService
{
    public function __construct(AgreementService $service)
    {
        $this->service = $service;
    }
    public function getIndexInfo(Request $request): JsonResponse
    {
        $result = $this->service->getIndexInfo($request->all());
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }

    public function getAgreementInfo(Request $request): JsonResponse
    {
        $result = $this->service->getAgreementInfo($request->all());
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }

    }
    public function agreementUpdate(Request $request): JsonResponse
    {
        $result = $this->service->agreementUpdate($request->all());
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }

    }
}
